package com.jinke.uang.common;

import android.view.View;

import java.util.Calendar;

/**
 * 防止重复点击的
 */
public abstract class NoDoubleClickListener implements View.OnClickListener {
    //防止重复的间隔
    private static final int MIN_CLICK_DELAY_TIME = 500;
    private long lastClickTime = 0;

    @Override
    public void onClick(View v) {
        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            onNoDoubleClick(v);
        }
    }

    /**
     * 按钮点击事件
     *
     * @param v
     */
    public void onNoDoubleClick(View v) {

    }
}